package com.imooc.bilibili.api;

import com.imooc.bilibili.auth.UserAuthService;
import com.imooc.bilibili.domain.auth.UserAuthorities;
import com.imooc.bilibili.domain.core.JsonResponse;
import com.imooc.bilibili.support.UserSupport;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author gcq
 * @Create 2022-05-31
 */
@RestController
public class UserAuthApi {

    @Autowired
    private UserSupport userSupport;

    @Autowired
    private UserAuthService userAuthService;

    @GetMapping("/user-authorities")
    public JsonResponse<UserAuthorities> getUserAuthorities() {
        UserAuthorities userAuthorities = userAuthService.getUserAuthorities(userSupport.getCurrentUserId());
        return new JsonResponse(userAuthorities);
    }
}